package com.xixi.controller;

import com.xixi.Service.DepartmentService;
import com.xixi.demo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping("/department") //一级访问目录
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("findAll") //二级访问目录
public List<Department> findAll(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse){
    System.out.println("查询所有员工。。。");
    List<Department> list=departmentService.findAllDepartment();
    httpServletRequest.getSession().setAttribute("list",list);
    return list;
}


}
